package org.cuatrovientos.empirefleet;

import java.util.Scanner;
import java.util.Vector;
/**
 * Represents an imperial fleet composed
 * of many space_ships
 * @author Sienar Fleet Systems
 * @greets the emperor
 */
public class Fleet extends Vector<SpaceShip> {
	String commander_name;

	/**
	 * creates fleet
	 * three steps: define commander name, create fleet, show fleet
	 */
	public void create_fleet () {
		Scanner read = new Scanner(System.in);
		int option=0;
		String name = "";

		// Give commander name
		do {
			System.out.println("Identify yourself");
			commander_name = read.nextLine();
		} while (commander_name.isEmpty());

		// We start a loop to define the fleet
		// In each loop commander chooses one kind of ship to be added
		// to his fleet
		do {
			System.out.println("What kind of ship do you want?");
			System.out.println("1.Tie Advanced \n 2.Tie Bomber \n 3.Tie Fighter \n 4.Exit\n");
			option = read.nextInt();
			System.out.println("Identify pilot");
		name = read.nextLine();
			SpaceShip.factory(option, name);
		} while( option != 4);

		// Resume: show complete fleet info
		// using foreach like for
		for (SpaceShip ship : this) {
			System.out.println("Type: " + ship.type + "," + ship.toString());
		}
	}
}
